//
// Created by bleedingfight on 2020/6/28.
//
#include "MyQueue.h"
void MyQueue::push(int x) {
    head_stack.push(x);
}
int MyQueue::pop() {
    int top_value = peek();
    tail_stack.pop();
    return top_value;
}
int MyQueue::peek() {
    if (tail_stack.empty()){
        while (!head_stack.empty()){
            tail_stack.push(head_stack.top());
            head_stack.pop();
        }
    }
    int top_value = tail_stack.top();
    return top_value;
}
bool MyQueue::empty() {
    return head_stack.empty()&&tail_stack.empty();
}
